<!DOCTYPE html>
<html>

<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">




    <title>传智旅游后台管理系统</title>
    <meta name="description" content="传智旅游后台管理系统">
    <meta name="keywords" content="传智旅游后台管理系统">




    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.6 -->
    <!-- Font Awesome -->
    <!-- Ionicons -->
    <!-- iCheck -->
    <!-- Morris chart -->
    <!-- jvectormap -->
    <!-- Date Picker -->
    <!-- Daterange picker -->
    <!-- Bootstrap time Picker -->
    <!--<link rel="stylesheet" href="../../../plugins/timepicker/bootstrap-timepicker.min.css">-->
    <!-- bootstrap wysihtml5 - text editor -->
    <!--数据表格-->
    <!-- 表格树 -->
    <!-- select2 -->
    <!-- Bootstrap Color Picker -->
    <!-- bootstrap wysihtml5 - text editor -->
    <!--bootstrap-markdown-->
    <!-- Theme style -->
    <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
    <!-- Ion Slider -->
    <!-- ion slider Nice -->
    <!-- bootstrap slider -->
    <!-- bootstrap-datetimepicker -->

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->








    <!-- jQuery 2.2.3 -->
    <!-- jQuery UI 1.11.4 -->
    <!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
    <!-- Bootstrap 3.3.6 -->
    <!-- Morris.js charts -->
    <!-- Sparkline -->
    <!-- jvectormap -->
    <!-- jQuery Knob Chart -->
    <!-- daterangepicker -->
    <!-- datepicker -->
    <!-- Bootstrap WYSIHTML5 -->
    <!-- Slimscroll -->
    <!-- FastClick -->
    <!-- iCheck -->
    <!-- AdminLTE App -->
    <!-- 表格树 -->
    <!-- select2 -->
    <!-- bootstrap color picker -->
    <!-- bootstrap time picker -->
    <!--<script src="../../../plugins/timepicker/bootstrap-timepicker.min.js"></script>-->
    <!-- Bootstrap WYSIHTML5 -->
    <!--bootstrap-markdown-->
    <!-- CK Editor -->
    <!-- InputMask -->
    <!-- DataTables -->
    <!-- ChartJS 1.0.1 -->
    <!-- FLOT CHARTS -->
    <!-- FLOT RESIZE PLUGIN - allows the chart to redraw when the window is resized -->
    <!-- FLOT PIE PLUGIN - also used to draw donut charts -->
    <!-- FLOT CATEGORIES PLUGIN - Used to draw bar charts -->
    <!-- jQuery Knob -->
    <!-- Sparkline -->
    <!-- Morris.js charts -->
    <!-- Ion Slider -->
    <!-- Bootstrap slider -->
    <!-- bootstrap-datetimepicker -->
    <!-- 页面meta /-->

    <link rel="stylesheet" href="../plugins/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../plugins/ionicons/css/ionicons.min.css">
    <link rel="stylesheet" href="../plugins/iCheck/square/blue.css">
    <link rel="stylesheet" href="../plugins/morris/morris.css">
    <link rel="stylesheet" href="../plugins/jvectormap/jquery-jvectormap-1.2.2.css">
    <link rel="stylesheet" href="../plugins/datepicker/datepicker3.css">
    <link rel="stylesheet" href="../plugins/daterangepicker/daterangepicker.css">
    <link rel="stylesheet" href="../plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
    <link rel="stylesheet" href="../plugins/datatables/dataTables.bootstrap.css">
    <link rel="stylesheet" href="../plugins/treeTable/jquery.treetable.css">
    <link rel="stylesheet" href="../plugins/treeTable/jquery.treetable.theme.default.css">
    <link rel="stylesheet" href="../plugins/select2/select2.css">
    <link rel="stylesheet" href="../plugins/colorpicker/bootstrap-colorpicker.min.css">
    <link rel="stylesheet" href="../plugins/bootstrap-markdown/css/bootstrap-markdown.min.css">
    <link rel="stylesheet" href="../plugins/adminLTE/css/AdminLTE.css">
    <link rel="stylesheet" href="../plugins/adminLTE/css/skins/_all-skins.min.css">
    <link rel="stylesheet" href="../css/style.css">
    <link rel="stylesheet" href="../plugins/ionslider/ion.rangeSlider.css">
    <link rel="stylesheet" href="../plugins/ionslider/ion.rangeSlider.skinNice.css">
    <link rel="stylesheet" href="../plugins/bootstrap-slider/slider.css">
    <link rel="stylesheet" href="../plugins/bootstrap-datetimepicker/bootstrap-datetimepicker.css">
    <link type="text/css" href="/css/style.css" rel="stylesheet" />
</head>

<body class="hold-transition skin-purple sidebar-mini">

<div class="wrapper">

    <!-- 页面头部 -->
    <header class="main-header">


        <!-- Logo -->
        <a href="all-admin-index.html" class="logo">
            <!-- mini logo for sidebar mini 50x50 pixels -->
            <span class="logo-mini"><b>传智</b></span>
            <!-- logo for regular state and mobile devices -->
            <span class="logo-lg"><b>传智旅游</b>后台管理</span>
        </a>


        <!-- Header Navbar: style can be found in header.less -->
        <nav class="navbar navbar-static-top">
            <!-- Sidebar toggle button-->
            <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
                <span class="sr-only">Toggle navigation</span>
            </a>

            <div class="navbar-custom-menu">
                <ul class="nav navbar-nav">
                    <!-- User Account: style can be found in dropdown.less -->
                    <li class="dropdown user user-menu">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <img src="../img/user2-160x160.jpg" class="user-image" alt="User Image">
                            <span class="hidden-xs">快乐</span>
                        </a>
                        <ul class="dropdown-menu">
                            <!-- User image -->
                            <li class="user-header">
                                <img src="../img/user2-160x160.jpg" class="img-circle" alt="User Image">

                                <p>
                                    快乐 - 系统管理眼
                                    <small>最后登录 11:20AM</small>
                                </p>
                            </li>
                            <!-- Menu Body
                            <li class="user-body">
                                <div class="row">
                                    <div class="col-xs-4 text-center">
                                        <a href="#">Followers</a>
                                    </div>
                                    <div class="col-xs-4 text-center">
                                        <a href="#">Sales</a>
                                    </div>
                                    <div class="col-xs-4 text-center">
                                        <a href="#">Friends</a>
                                    </div>
                                </div>
                            </li>-->
                            <!-- Menu Footer-->
                            <li class="user-footer">
                                <div class="pull-left">
                                    <a href="#" class="btn btn-default btn-flat">修改密码</a>
                                </div>
                                <div class="pull-right">
                                    <a href="/loginOut.action" class="btn btn-default btn-flat">注销</a>
                                </div>
                            </li>
                        </ul>
                    </li>

                </ul>
            </div>
        </nav>
    </header>
    <!-- 页面头部 /-->

    <!-- 导航侧栏 -->
    <aside class="main-sidebar">
        <!-- sidebar: style can be found in sidebar.less -->
        <section class="sidebar">
            <!-- Sidebar user panel -->
            <div class="user-panel">
                <div class="pull-left image">
                    <img src="../img/user2-160x160.jpg" class="img-circle" alt="User Image">
                </div>
                <div class="pull-left info">
                    <p>快乐</p>
                    <a href="#"><i class="fa fa-circle text-success"></i> 在线</a>
                </div>
            </div>
            <!-- search form -->
            <!--<form action="#" method="get" class="sidebar-form">
                <div class="input-group">
                    <input type="text" name="q" class="form-control" placeholder="搜索...">
                    <span class="input-group-btn">
                    <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
                    </button>
                  </span>
                </div>
            </form>-->
            <!-- /.search form -->


            <!-- sidebar menu: : style can be found in sidebar.less -->
            <ul class="sidebar-menu">
                <li class="header">菜单</li>

                <li id="admin-index"><a href="/pages/admin-homePage.html"><i class="fa fa-dashboard"></i>
                    <span>首页</span></a></li>

                <!-- 菜单 -->

                <li class="treeview">
                    <a href="#">
                        <i class="glyphicon glyphicon-th"></i> <span>系统管理</span>
                        <span class="pull-right-container">
                                <i class="fa fa-angle-left pull-right"></i>
                            </span>
                    </a>
                    <ul class="treeview-menu">

                        <li id="admin-login">
                            <a href="#">
                                <i class="fa fa-folder"></i> <span>权限管理</span>
                                <span class="pull-right-container">
                                        <i class="fa fa-angle-left pull-right"></i>
                                    </span>
                            </a>
                            <ul class="treeview-menu">

                                <li id="admin-user">
                                    <a href="/pages/admin-userAdmin.html">
                                        <i class="glyphicon glyphicon-user"></i> 用户管理
                                    </a>
                                </li>

                                <li id="admin-role">
                                    <a href="/pages/admin-roleAdmin.html">
                                        <i class="glyphicon glyphicon-indent-left"></i> 角色管理
                                    </a>
                                </li>
                                <li id="admin-resource">
                                    <a href="/pages/admin-resources.html">
                                        <i class="glyphicon glyphicon-saved"></i> 资源权限
                                    </a>
                                </li>
                            </ul>
                        </li>
                        <li id="admin-register">
                            <a href="/pages/admin-logAdmin.html">
                                <i class="glyphicon glyphicon-list-alt"></i> 日志管理
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="treeview">
                    <a href="#">
                        <i class="fa fa-pie-chart"></i> <span>产品管理</span>
                        <span class="pull-right-container">
                                <i class="fa fa-angle-left pull-right"></i>
                            </span>
                    </a>
                    <ul class="treeview-menu">

                        <li id="charts-chartjs">
                            <a href="/pages/admin-routeInfo.html">
                                <i class="fa fa-search"></i> 产品信息
                            </a>
                        </li>

                        <li id="charts-morris">
                            <a href="/pages/admin-addRoute.html">
                                <i class="fa  fa-plus"></i> 添加产品
                            </a>
                        </li>

                    </ul>
                </li>

            </ul>
        </section>
        <!-- /.sidebar -->
    </aside>
    <!-- 导航侧栏 /-->

    <!-- 内容区域 -->
    <div class="content-wrapper">

        <!-- 内容头部 -->
        <section class="content-header">
            <h1>
                系统管理
                <small>用户管理</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="admin-homePage.html"><i class="fa fa-dashboard"></i>首页</a></li>
                <li><a href="#">系统管理</a></li>
                <li class="active">用户管理</li>
            </ol>
        </section>
        <!-- 内容头部 /-->

        <!-- 正文区域 -->
        <section class="content">

            <!-- .box-body -->
            <div class="box box-primary">
                <div class="box-header with-border">
                    <h3 class="box-title">用户信息</h3>
                </div>

                <div class="box-body">

                    <!-- 数据表格 -->
                    <div class="table-box">

                        <!--工具栏-->
                        <div class="pull-left">
                            <div class="form-group form-inline">
                                <div class="btn-group">
                                    <button type="button" class="btn btn-default" title="添加用户" data-toggle="modal" data-target="#myModal"><i
                                            class="glyphicon glyphicon-plus"></i> 添加用户</button>
                                    <button type="button" class="btn btn-default delAllUser" title="批量删除"
                                    ><i class="fa fa-trash-o"></i> 批量删除</button>
                                    <button type="button" class="btn btn-default" title="刷新"
                                            onclick="window.location.reload();"><i class="fa fa-refresh"></i>
                                        刷新</button>
                                </div>
                            </div>
                        </div>
                        <div class="box-tools pull-right">
                            <div class="has-feedback">
                                <input type="text" class="form-control input-sm" placeholder="搜索">
                                <span class="glyphicon glyphicon-search form-control-feedback"></span>
                            </div>
                        </div>
                        <!--工具栏/-->

                        <!--数据列表-->
                        <table id="dataList" class="table table-bordered table-striped table-hover dataTable">
                            <thead>
                            <tr>
                                <th class="" style="padding-right:0px;">
                                    <input id="selall" type="checkbox" class="icheckbox_square-blue">
                                </th>
                                <th class="sorting_asc">用户编号</th>
                                <th class="sorting">用户名</th>
                                <th class="sorting">邮箱</th>
                                <th class="sorting">手机号码</th>
                                <th class="sorting">性别</th>
                                <th class="sorting">状态</th>
                                <th class="text-center">操作</th>
                            </tr>
                            </thead>
                            <tbody>



                            <!--    <tr>
                                    <td><input name="ids" type="checkbox"></td>
                                    <td>
                                        1
                                    </td>
                                    <td>张三</td>
                                    <td>xxx@163.com</td>
                                    <td>18396815985</td>
                                    <td>男</td>
                                    <td>已锁定/正常</td>
                                    <td class="text-center">
                                        <button type="button" class="btn bg-olive btn-xs"
                                            onclick='location.href="all-order-manage-edit.html"'>删除</button>
                                        <button type="button" class="btn bg-olive btn-xs"
                                            onclick='location.href="all-order-manage-edit.html"'>详情</button>
                                        <button type="button" class="btn bg-olive btn-xs"
                                            onclick='location.href="all-order-manage-edit.html"'>编辑</button>
                                    </td>
                                </tr>


                                <tr>
                                    <td><input name="ids" type="checkbox"></td>
                                    <td>
                                        1
                                    </td>
                                    <td>张三</td>
                                    <td>xxx@163.com</td>
                                    <td>18396815985</td>
                                    <td>男</td>
                                    <td>已锁定/正常</td>
                                    <td class="text-center">
                                        <button type="button" class="btn bg-olive btn-xs"
                                                onclick='location.href="all-order-manage-edit.html"'>删除</button>
                                        <button type="button" class="btn bg-olive btn-xs"
                                                onclick='location.href="all-order-manage-edit.html"'>详情</button>
                                        <button type="button" class="btn bg-olive btn-xs"
                                                onclick='location.href="all-order-manage-edit.html"'>编辑</button>
                                    </td>
                                </tr>


                                <tr>
                                    <td><input name="ids" type="checkbox"></td>
                                    <td>
                                        1
                                    </td>
                                    <td>张三</td>
                                    <td>xxx@163.com</td>
                                    <td>18396815985</td>
                                    <td>男</td>
                                    <td>已锁定/正常</td>
                                    <td class="text-center">
                                        <button type="button" class="btn bg-olive btn-xs"
                                                onclick='location.href="all-order-manage-edit.html"'>删除</button>
                                        <button type="button" class="btn bg-olive btn-xs"
                                                onclick='location.href="all-order-manage-edit.html"'>详情</button>
                                        <button type="button" class="btn bg-olive btn-xs"
                                                onclick='location.href="all-order-manage-edit.html"'>编辑</button>
                                    </td>
                                </tr>


                                <tr>
                                    <td><input name="ids" type="checkbox"></td>
                                    <td>
                                        1
                                    </td>
                                    <td>张三</td>
                                    <td>xxx@163.com</td>
                                    <td>18396815985</td>
                                    <td>男</td>
                                    <td>已锁定/正常</td>
                                    <td class="text-center">
                                        <button type="button" class="btn bg-olive btn-xs"
                                                onclick='location.href="all-order-manage-edit.html"'>删除</button>
                                        <button type="button" class="btn bg-olive btn-xs"
                                                onclick='location.href="all-order-manage-edit.html"'>详情</button>
                                        <button type="button" class="btn bg-olive btn-xs"
                                                onclick='location.href="all-order-manage-edit.html"'>编辑</button>
                                    </td>
                                </tr>


                                <tr>
                                    <td><input name="ids" type="checkbox"></td>
                                    <td>
                                        1
                                    </td>
                                    <td>张三</td>
                                    <td>xxx@163.com</td>
                                    <td>18396815985</td>
                                    <td>男</td>
                                    <td>已锁定/正常</td>
                                    <td class="text-center">
                                        <button type="button" class="btn bg-olive btn-xs"
                                                onclick='location.href="all-order-manage-edit.html"'>删除</button>
                                        <button type="button" class="btn bg-olive btn-xs"
                                                onclick='location.href="all-order-manage-edit.html"'>详情</button>
                                        <button type="button" class="btn bg-olive btn-xs"
                                                onclick='location.href="all-order-manage-edit.html"'>编辑</button>
                                    </td>
                                </tr>


                                <tr>
                                    <td><input name="ids" type="checkbox"></td>
                                    <td>
                                        1
                                    </td>
                                    <td>张三</td>
                                    <td>xxx@163.com</td>
                                    <td>18396815985</td>
                                    <td>男</td>
                                    <td>已锁定/正常</td>
                                    <td class="text-center">
                                        <button type="button" class="btn bg-olive btn-xs"
                                                onclick='location.href="all-order-manage-edit.html"'>删除</button>
                                        <button type="button" class="btn bg-olive btn-xs"
                                                onclick='location.href="all-order-manage-edit.html"'>详情</button>
                                        <button type="button" class="btn bg-olive btn-xs"
                                                onclick='location.href="all-order-manage-edit.html"'>编辑</button>
                                    </td>
                                </tr>


                                <tr>
                                    <td><input name="ids" type="checkbox"></td>
                                    <td>
                                        1
                                    </td>
                                    <td>张三</td>
                                    <td>xxx@163.com</td>
                                    <td>18396815985</td>
                                    <td>男</td>
                                    <td>已锁定/正常</td>
                                    <td class="text-center">
                                        <button type="button" class="btn bg-olive btn-xs"
                                                onclick='location.href="all-order-manage-edit.html"'>删除</button>
                                        <button type="button" class="btn bg-olive btn-xs"
                                                onclick='location.href="all-order-manage-edit.html"'>详情</button>
                                        <button type="button" class="btn bg-olive btn-xs"
                                                onclick='location.href="all-order-manage-edit.html"'>编辑</button>
                                    </td>
                                </tr>


                                <tr>
                                    <td><input name="ids" type="checkbox"></td>
                                    <td>
                                        1
                                    </td>
                                    <td>张三</td>
                                    <td>xxx@163.com</td>
                                    <td>18396815985</td>
                                    <td>男</td>
                                    <td>已锁定/正常</td>
                                    <td class="text-center">
                                        <button type="button" class="btn bg-olive btn-xs"
                                                onclick='location.href="all-order-manage-edit.html"'>删除</button>
                                        <button type="button" class="btn bg-olive btn-xs"
                                                onclick='location.href="all-order-manage-edit.html"'>详情</button>
                                        <button type="button" class="btn bg-olive btn-xs"
                                                onclick='location.href="all-order-manage-edit.html"'>编辑</button>
                                    </td>
                                </tr>
-->
                            </tbody>
                            <!--
                        <tfoot>
                        <tr>
                        <th>Rendering engine</th>
                        <th>Browser</th>
                        <th>Platform(s)</th>
                        <th>Engine version</th>
                        <th>CSS grade</th>
                        </tr>
                        </tfoot>-->
                        </table>
                        <!--数据列表/-->

                        <!--工具栏/-->

                    </div>
                    <!-- 数据表格 /-->


                </div>
                <!-- /.box-body -->

                <!-- .box-footer-->
                <div class="box-footer">
                    <div class="pull-left">
                        <div class="form-group form-inline">
                            总共2 页，共14 条数据。 每页
                            <select class="form-control">
                                <option>2</option>
                                <option>5</option>
                                <option selected="selected">10</option>
                                <option>20</option>
                                <option>50</option>
                            </select> 条
                        </div>
                    </div>

                    <div class="box-tools pull-right">
                        <ul class="pagination">
                            <li>
                                <a href="#" aria-label="Previous">首页</a>
                            </li>
                            <li><a href="#">上一页</a></li>
                            <li><a href="#">1</a></li>
                            <li><a href="#">2</a></li>
                            <li><a href="#">3</a></li>
                            <li><a href="#">4</a></li>
                            <li><a href="#">5</a></li>
                            <li><a href="#">下一页</a></li>
                            <li>
                                <a href="#" aria-label="Next">尾页</a>
                            </li>
                        </ul>
                    </div>

                </div>
                <!-- /.box-footer-->


            </div>

        </section>
        <!-- 添加用户的模态框 /-->
        <!-- Modal -->
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog modal-lg" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel">添加新用户</h4>
                    </div>
                    <div class="modal-body">
                        <div class="row data-type">

                            <div class="col-md-2 title">用户名</div>
                            <div class="col-md-4 data">
                                <input type="text" class="form-control" name="username" placeholder="用户名" value="">
                            </div>

                            <div class="col-md-2 title">密码</div>
                            <div class="col-md-4 data">
                                <input type="password" class="form-control" name="password" placeholder="密码" value="">
                            </div>

                            <div class="col-md-2 title">邮箱</div>
                            <div class="col-md-4 data">
                                <input type="email" class="form-control" name="email" placeholder="邮箱" value="">
                            </div>

                            <div class="col-md-2 title">联系方式</div>
                            <div class="col-md-4 data">
                                <input type="number" class="form-control" name="phone" placeholder="联系方式" value="">
                            </div>

                            <div class="col-md-2 title">性别</div>
                            <div class="col-md-4">
                                <input type="radio" checked="checked"  name="sex" value="M"/>男
                                <input type="radio"  name="sex" value="F"/>女
                            </div>

                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary saveUserBtn">添加</button>
                    </div>
                </div>
            </div>
        </div>
        <!-- 用户详情的模态框 -->
        <div class="modal fade" id="userDetail" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog modal-lg" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title">用户详情</h4>
                    </div>
                    <div class="modal-body">
                        <div class="tab-pane active" id="tab-treetable">
                            <table id="collapse-table" class="table table-bordered table-hover dataTable treetable">
<!--
                                <tr data-tt-id="0" class="branch collapsed">
                                    <td>自主访问</td>
                                </tr>
                                <tr data-tt-id="1" data-tt-parent-id="0" class="branch collapsed" style="display: none;">
                                    <td>我的京东</td>
                                </tr>
                                <tr data-tt-id="1-1" data-tt-parent-id="1" class="leaf" style="display: none;">
                                    <td></span>我的京东一</td>
                                </tr>
                                <tr data-tt-id="1-1" data-tt-parent-id="1" class="leaf" style="display: none;">
                                    <td></span>我的京东二</td>
                                </tr>

                                <tr data-tt-id="2" data-tt-parent-id="0" class="branch collapsed" style="display: none;">
                                    <td></span>购物车</td>
                                </tr>
                                <tr data-tt-id="2-1" data-tt-parent-id="2" class="leaf" style="display: none;">
                                    <td>购物车一</td>
                                </tr>
                                <tr data-tt-id="2-2" data-tt-parent-id="2" class="leaf" style="display: none;">
                                    <td>购物车二</td>
                                </tr>-->

                            </table>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    </div>
                </div>
            </div>
        </div>
        <!--绑定角色的模态框-->
        <div class="modal fade" id="addRoleModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog modal-lg" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title">绑定角色</h4>
                    </div>
                    <div class="modal-body">
                        <div class="panel panel-default">
                            <div class="panel-body showRolePanel">
                                可选角色列表
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal" >关闭</button>
                        <button type="button" class="btn btn-info" id="submitRoleBtn">提交</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- 内容区域 /-->

    <!-- 底部导航 -->
    <footer class="main-footer">
        <div class="pull-right hidden-xs">
            <b>Version</b> 1.0.8
        </div>
        <strong>Copyright &copy; 2014-2017 <a href="http://www.ytyouye.com/">优业科技</a>.</strong> All rightsreserved.
    </footer>
    <!-- 底部导航 /-->

</div>


<script src="../plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="../plugins/jQueryUI/jquery-ui.min.js"></script>
<script>
    $.widget.bridge('uibutton', $.ui.button);
</script>
<script src="../plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="../plugins/raphael/raphael-min.js"></script>
<script src="../plugins/morris/morris.min.js"></script>
<script src="../plugins/sparkline/jquery.sparkline.min.js"></script>
<script src="../plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
<script src="../plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
<script src="../plugins/knob/jquery.knob.js"></script>
<script src="../plugins/datepicker/bootstrap-datepicker.js"></script>
<script src="../plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
<script src="../plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>
<script src="../plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="../plugins/fastclick/fastclick.js"></script>
<script src="../plugins/iCheck/icheck.min.js"></script>
<script src="../plugins/adminLTE/js/app.min.js"></script>
<script src="../plugins/treeTable/jquery.treetable.js"></script>
<script src="../plugins/select2/select2.full.min.js"></script>
<script src="../plugins/colorpicker/bootstrap-colorpicker.min.js"></script>
<script src="../plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.zh-CN.js"></script>
<script src="../plugins/bootstrap-markdown/js/bootstrap-markdown.js"></script>
<script src="../plugins/bootstrap-markdown/locale/bootstrap-markdown.zh.js"></script>
<script src="../plugins/bootstrap-markdown/js/markdown.js"></script>
<script src="../plugins/bootstrap-markdown/js/to-markdown.js"></script>
<script src="../plugins/ckeditor/ckeditor.js"></script>
<script src="../plugins/input-mask/jquery.inputmask.js"></script>
<script src="../plugins/input-mask/jquery.inputmask.date.extensions.js"></script>
<script src="../plugins/chartjs/Chart.min.js"></script>
<script src="../plugins/flot/jquery.flot.min.js"></script>
<script src="../plugins/flot/jquery.flot.resize.min.js"></script>
<script src="../plugins/flot/jquery.flot.pie.min.js"></script>
<script src="../plugins/flot/jquery.flot.categories.min.js"></script>
<script src="../plugins/ionslider/ion.rangeSlider.min.js"></script>
<script src="../plugins/bootstrap-slider/bootstrap-slider.js"></script>
<script src="../plugins/bootstrap-datetimepicker/bootstrap-datetimepicker.js"></script>
<script src="../plugins/bootstrap-datetimepicker/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<script>

    // 将用户信息渲染到table表格中
    var userRender = function(data){
        let tBody = $("#dataList>tbody");
        tBody.html("");
        for(let i = 0 ; i<data.length ; i++){
            let tr = $('<tr></tr>');
            $('<td><input name="ids" class="icheckbox_square-blue" type="checkbox" value="'+data[i].uId+'"></td>').appendTo(tr);
            $(`<td>${data[i].uId} <span name="${data[i].uId}"></span> </td>`).appendTo(tr);
            $(`<td>${data[i].username}</td>`).appendTo(tr);
            $(`<td>${data[i].email}</td>`).appendTo(tr);
            $(`<td>${data[i].phone}</td>`).appendTo(tr);
            $(`<td>${data[i].sex=='F'?"女":"男"}</td>`).appendTo(tr);
            $(`<td>${data[i].status==0?"锁定":"未锁定"} <input class="userStatus" value="${data[i].status}" hidden="hidden"></input></td>`).appendTo(tr);
            let td = $("<td class='text-center'></td>");
            td.append("<button type=\"button\" class=\"btn bg-olive btn-xs lockBtn\"'>"+(data[i].status==0?'解锁':'锁定')+"</button> ");
            td.append("<button type=\"button\" class=\"btn bg-olive btn-xs delBtn\"'>删除</button> ");
            td.append("<button type=\"button\" class=\"btn bg-olive btn-xs detailBtn\"'>详情</button> ");
            td.append("<button type=\"button\" class=\"btn bg-olive btn-xs editBtn\"'>编辑</button> ");
            td.append("<button type=\"button\" class=\"btn bg-olive btn-xs addRole\"'>绑定角色</button> ");
            tr.append(td);
            tBody.append(tr);
        }
    }
    //查询用户信息
    var showAllUser = function(){
        $.get("/showAllUser.action",function(response){
            //console.log(response);
            //数据填充
            userRender(response);
        });
    }
    showAllUser();
    //删除单条用户信息
    $('#dataList>tbody').on('click','.delBtn',function(){
        //获取id
        if(confirm("确认要删除该用户信息吗?")){
            let uId = $(this).parent().parent().find("span").attr("name");
            //发送ajax请求到后台 删除用户信息
            $.post("/user/delUser.action",{uId},function (res){
                if(res == 0){
                    alert("删除失败,请查看日志信息~~");
                }else{
                    alert("删除成功");
                    location.reload();
                }
            },"json");
        }
    });
    //批量删除
    $('.delAllUser').click(function (){
        // 获取选中的id
        let uId = $('#dataList>tbody input[name=ids]').serialize();
        console.log(uId);
        if(!uId){
            alert("请选择需要删除的用户")
        }else{
            if(confirm("您确定要删除这些用户的信息吗?")){
                $.post("/user/delAllUser.action",uId,function(res){
                    if(res!=0){
                        alert("删除成功");
                        location.reload();
                    }else{
                        alert("删除失败,请查看日志了解详情~");
                    }
                })
            }
        }
    });
    //锁定和解锁
    $('#dataList>tbody').on('click','.lockBtn',function(){
        let status = $(this).parent().parent().find('.userStatus').val();
        let uId = $(this).parent().parent().find('span').attr('name');
        status = status==1?0:1;
        let user = {uId,status};
        console.log(user);
        $.post('/user/lockUser.action',user,function(res){
            if(res == 0){
                alert("操作失败~请查看日志了解详情");
            }else{
                alert('操作成功~');
                location.reload();
            }
        });
    });
    //添加用户
    $('.saveUserBtn').click(function(){
        let user = $('#myModal input').serialize();
        $.post('/user/addUser.action',user,function (res){
            if(res==0){
                alert('添加失败~请查看日志了解详情');
            }else{
                alert('添加成功~');
                location.reload();
            }
        });
    });
    //用户详情
    $('#dataList>tbody').on('click','.detailBtn',function(){
        let uId = $(this).parent().parent().find('span').attr('name');
        $.post('/showUserDetails.action',{uId},function(res){
            console.log(res);
            //console.log(res.roleList[0].permissionList[0].pId);
            $('#userDetail').modal('show');
            $('#collapse-table').html("");
            $('#collapse-table').append(`<tr><td>用户编号 : ${res.uId}</td></tr>`)
            $('#collapse-table').append(`<tr><td>用户名 : ${res.username}</td></tr>`)
            $('#collapse-table').append(`<tr><td>密码 : ${res.email}</td></tr>`)
            $('#collapse-table').append(`<tr><td>邮箱 : ${res.phone}</td></tr>`)
            $('#collapse-table').append(`<tr><td>性别 : ${res.sex=='F'?'女':'男'}</td></tr>`)
            $('#collapse-table').append(`<tr><td>用户状态 : ${res.status==0?'已锁定':'正常状态'}</td></tr>`)
            //角色
            $('#collapse-table').append(`<tr data-tt-id = "0" class = "branch collapsed" > <td> 角色信息 </td></tr>`)
            if(res.roleList.length){
                for(let i = 0;i<res.roleList.length;i++){
                    $('#collapse-table').append(`<tr data-tt-id="0-${i+1}" data-tt-parent-id="0" class="branch collapsed" style="display:none" > <td> ${res.roleList[i].rId+"--"+res.roleList[i].roleName+"--"+res.roleList[i].roleDesc } </td></tr>`);
                    //权限
                    if(res.roleList[i].permissionList.length){
                        for(let j = 0; j<res.roleList[i].permissionList.length;j++){
                            $('#collapse-table').append(`<tr data-tt-id="0-${i+1}-${j+1}" data-tt-parent-id="0-${i+1}" class="branch collapsed" style="display:none" > <td> ${res.roleList[i].permissionList[j].pId}--${res.roleList[i].permissionList[j].permissionName}--${res.roleList[i].permissionList[j].url}</td></tr>`);
                        }
                    }else{
                        console.log("没有权限");
                        $('#collapse-table').append(`<tr data-tt-id="xx" data-tt-parent-id="0-${i+1}" class="branch collapsed" style="display:none" > <td>该角色尚未分配权限</td></tr>`);
                    }
                }
            }else{
                console.log("没有角色");
                $('#collapse-table').append(`<tr data-tt-id="xxx" data-tt-parent-id="0" class="branch collapsed" style="display:none" > <td>该用户尚未绑定角色</td></tr>`);
            }
            $("#collapse-table").treetable({
                expandable: true
            },true); // force 属性 强制初始化树结构
        });
    });
    // 展示可选的角色
    $('#dataList tbody').on('click','.addRole',function(){
        $('#addRoleModal').modal('show');
        let uId = $(this).parent().parent().find("span").attr("name");
        $('.showRolePanel').html('');
        // 根据用户id  该用户可绑定的角色
        $.post('/user/showRoles.action',{uId},function(res){
            if(res.length==0){
                $('.showRolePanel').html(`<span class="text-info">暂时没有可以绑定的角色</span>`);
            }else{
                for(let i = 0;i<res.length;i++){
                    $('.showRolePanel').append(`<span style="font-size:20px"  title="${res[i].roleDesc}">${res[i].roleName}</span>  <input type="checkbox" name="rIds" class="icheckbox_square-blue " value="${res[i].rId}">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`);
                }
                $('.showRolePanel').append(`<input type="text" value="${uId}" name="uId" hidden="hidden">`);
            }
        })
    })
    //绑定角色
    $('#submitRoleBtn').click(function(){
        //获取用户id
        let uId = $('.showRolePanel').find('input[name=uId]').val();
        //获取所选的角色id
        let rIds = $('.showRolePanel').find('input[name=rIds]').serialize();
        if(rIds){
            let rList = [];
            for(let i = 0;i<rIds.split("&").length;i++){
                rList[i] = Number.parseInt(rIds.split("&")[i].split("=")[1]);
            }
            console.log({uId,rList});
            $.post("/user/addRoles.action",{uId,rList},function(res){
                if(res == 0){
                    alert('绑定角色失败~,请根据日志获取详细信息');
                }else{
                    alert('绑定角色成功');
                    location.reload();
                }
            });
        }else{
            alert("请选择需要绑定的角色~");
        }
    });

        $(document).ready(function () {
            // 选择框
            $(".select2").select2();

            // WYSIHTML5编辑器
            $(".textarea").wysihtml5({
                locale: 'zh-CN'
            });
        });


        // 设置激活菜单
        function setSidebarActive(tagUri) {
            var liObj = $("#" + tagUri);
            if (liObj.length > 0) {
                liObj.parent().parent().addClass("active");
                liObj.addClass("active");
            }
        }


        $(document).ready(function () {

            // 激活导航位置
            //setSidebarActive("admin-log");
            setSidebarActive("admin-log");
            setSidebarActive("admin-login");

            // 列表按钮
            $("#dataList td input[type='checkbox']").iCheck({
                checkboxClass: 'icheckbox_square-blue',
                increaseArea: '20%'
            });
            // 全选操作
            $("#selall").click(function () {
                var clicks = $(this).is(':checked');
                if (!clicks) {
                    $("#dataList td input[type='checkbox']").iCheck("uncheck");
                } else {
                    $("#dataList td input[type='checkbox']").iCheck("check");
                }
                $(this).data("clicks", !clicks);
            });
        });
    </script>
</body>

</html>